package com.wzx.user.sdk.controller;

import com.wzx.common.exception.LeadNewsException;
import com.wzx.common.pojo.resp.Result;
import com.wzx.user.sdk.service.OssService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author wzx
 * @version 1.0
 * @date 2022/7/22 - 15:56
 * @description 标题
 */
@RestController
@RequestMapping("/oss")
@Slf4j
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) throws IOException, LeadNewsException {
        String url = ossService.upload(file);
        return Result.ok(url);
    }


}
